package com.osfw.framework.config.generator;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.osfw.framework.utils.SnowflakeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

// 声明为 Bean 供 Spring 扫描注入
@Slf4j
@Component
public class IdGenerator implements IdentifierGenerator {
    @Override
    public Number nextId(Object entity) {
        // 返回生成的id值即可
        return SnowflakeUtil.generatorId();
    }
}
